<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ page import="com.conversationboard.model.*" %>
<%@ page import="com.conversationboard.config.*" %>
<%@ page import="com.conversationboard.view.MainMenu"%>

<%@ page pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8"%>

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<title>Site New Answers</title>
		<link rel="stylesheet" title="Conversation Board" type="text/css" href="<%=Configuration.getInstance().getRoot()%>/Stylesheets/<%=StyleSheets.getStyleSheetFileName(request.getCookies())%>">
	</head>

	<%= MainMenu.display(request.getUserPrincipal()) %>

	<body>
	
		<% if (SiteMessage.getMessage() != null) { %>	
		<div class='sitemessage'><%= SiteMessage.getMessage() %></div>
		<% } %>
		<% if (BatchMessage.getMessage() != null) { %>	
		<div class='batchmessage'><%= BatchMessage.getMessage() %></div>
		<% } %>
	
		<div class="headingblock">
			<h1>Possible Existing Threads...</h1>
		</div>
		
		<!-- Have to in fact create multiple forms here, so as I can resubmit the question text etc. -->
				
		<div class="mainblock">

			<div class="formsection">

			<p>You are attempting to post a new thread, entitled: <em>${questionTitle}</em>. The system has identified some other threads, which look a
			   similar to your thread. If you would rather post your text as a response to one of these threads, click one of the links below. If not,
			   click <strong>Post as New Thread</strong> below to carry on and create a new thread.</p>
		
			<table class="table">
				<tr class="header">
					<th class="cell">Existing Thread</th>
					<th class="cell">Board</th>
					<th class="cell">Author</th>
					<th class="cell">Post Here</th>
				</tr>

				<c:forEach var="thread" items="${threadHits}">
					<tr class="row">
						<td class="cell">${thread.title}</td>
						<td class="cell">${thread.boardName}</td>
						<td class="cell">${thread.displayName}</td>
						<td class="cell">
							<form action="<%=Configuration.getInstance().getRoot() %>/NewQuestionControllerServlet?confirm=true" method="POST">
								<input name="sKey" value="${sKey}" type="hidden" />
								<input name="boardId" value="${thread.boardId}" type="hidden" />
								<input name="threadId" value="${thread.threadId}" type="hidden" />
					 			<input name="poll" value="false" type="hidden" />
					 			<input name="adminId" value="${adminId}" type="hidden" />
					 			<input name="questionTitle" value="${questionTitle}" type="hidden" />
					 			<input name="text" value="${questionText}" type="hidden" />
							 	<input type="submit" value="Post On This Thread" />
							</form>
						</td>
					</tr>
				</c:forEach>
			</table>

			<p>I would like this posted as a new thread:</p>

			<form action="<%=Configuration.getInstance().getRoot() %>/NewQuestionControllerServlet?confirm=true&newthread=true" method="POST">
				<input name="sKey" value="${sKey}" type="hidden" />
				<input name="boardId" value="${targetBoardId}" type="hidden" />
	 			<input name="poll" value="false" type="hidden" />
	 			<input name="adminId" value="${adminId}" type="hidden" />
	 			<input name="questionTitle" value="${questionTitle}" type="hidden" />
	 			<input name="questionText" value="${questionText}" type="hidden" />
			 	<input type="submit" value="Post As New Thread" />
			</form>
		
			</div>
		
		</div>
		
		<!--<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>-->
		<!--<script type="text/javascript">_uacct = "UA-1148679-1";urchinTracker();</script>--> 
		
	</body>
	
</html>
